From: Kouya Shimura Date: Wed, 15 Dec 2010 16:49:06 +0000 (+0000) Subject: tools/hotplug/Linux: force release lock if holder process is gone (fix) X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=5d0efa621fff90f4252108dacb8155f222145c96;p=xen.git tools/hotplug/Linux: force release lock if holder process is gone (fix) 22508:57907b28e51a was unsafe for mutual exclusion. There is a case that the owner file doesn't exist yet when an atomic mkdir operation fails. Signed-off-by: Kouya Shimura Signed-off-by: Ian Jackson --- diff --git a/tools/hotplug/Linux/locking.sh b/tools/hotplug/Linux/locking.sh index 8748d95454..e233c4763a 100644 --- a/tools/hotplug/Linux/locking.sh +++ b/tools/hotplug/Linux/locking.sh @@ -63,7 +63,7 @@ _claim_lock() retries=0 else local pid=$(echo $owner | cut -d : -f 1) - if [ ! -f "/proc/$pid/status" ] + if [ -n "$pid" -a "$pid" != "unknown" -a ! -f "/proc/$pid/status" ] then _release_lock $lockdir fi